package com.cz.nongyetongv5.bean;

import java.io.Serializable;

public class User implements Serializable {
    public String getStreetId() {

        String townId = null;

        String[] ids = getTown_path_id().split(",");

        if (ids.length >= 5) {

            townId = ids[4];

        }
        return townId;

    }

    private String username;

    private String password;

    private String town_path_id;

    private String showname;


    private String realname;

    private String region_name;

    public String getRegion_name() {
        return region_name;
    }

    public void setRegion_name(String region_name) {
        this.region_name = region_name;
    }

    // 区域的拼音简写
    private String localPySimple;

    private boolean tester;

    private String message;

    public String getRealname() {
        return realname;
    }

    public void setRealname(String realname) {
        this.realname = realname;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getTown_path_id() {
        return town_path_id;
    }

    public void setTown_path_id(String town_path_id) {
        this.town_path_id = town_path_id;
    }

    private double region_longitude;

    private double region_latitude;

    private int region_zoom;

    public User(String username, String password, String town_path_id) {

        this.username = username;
        this.password = password;
        this.town_path_id = town_path_id;
    }

    public User(String username, String password, String town_path_id,
                String showname) {

        this.username = username;
        this.password = password;
        this.town_path_id = town_path_id;
        this.showname = showname;
    }

    public User(String username, String password, String town_path_id,
                String showname, String localPySimple, double region_longitude,
                double region_latitude, int region_zoom, boolean tester, String realname, String region_name) {

        this.username = username;
        this.password = password;
        this.town_path_id = town_path_id;
        this.showname = showname;
        this.localPySimple = localPySimple;

        this.region_longitude = region_longitude;
        this.region_latitude = region_latitude;

        this.region_zoom = region_zoom;
        this.tester = tester;
        this.realname = realname;
        this.region_name = region_name;

    }

    public User() {
    }

    public String getShowname() {
        return showname;
    }

    public void setShowname(String showname) {
        this.showname = showname;
    }

    // 32,324
    public String getProvinceId() {

        String provinceId = null;

        String[] ids = this.getTown_path_id().split(",");

        if (ids.length >= 1) {
            provinceId = ids[0];

        }

        return provinceId;

    }

    public String getCityId() {

        String cityId = null;

        String[] ids = this.getTown_path_id().split(",");

        if (ids.length >= 2) {

            cityId = ids[1];

        }

        return cityId;

    }

    public String getArea() {

        String townId = null;

        String[] ids = this.getTown_path_id().split(",");

        if (ids.length >= 3) {

            townId = ids[2];
        }

        return townId;
    }

    public String getTownId() {

        String townId = null;

        String[] ids = this.getTown_path_id().split(",");

        if (ids.length >= 4) {

            townId = ids[3];

        }
        return townId;

    }

    public String getKnowRegion() {

        if (getTownId() != null) {

            return getTownId();
        }

        if (getArea() != null) {

            return getArea();
        }

        if (getCityId() != null) {

            return getCityId();
        }

        if (getProvinceId() != null) {

            return getProvinceId();
        }

        return null;

    }

    public String getLocalPySimple() {
        return localPySimple;
    }

    public void setLocalPySimple(String localPySimple) {
        this.localPySimple = localPySimple;
    }

    public double getRegion_longitude() {
        return region_longitude;
    }

    public void setRegion_longitude(double region_longitude) {
        this.region_longitude = region_longitude;
    }

    public double getRegion_latitude() {
        return region_latitude;
    }

    public void setRegion_latitude(double region_latitude) {
        this.region_latitude = region_latitude;
    }

    public int getRegion_zoom() {
        return region_zoom;
    }

    public void setRegion_zoom(int region_zoom) {
        this.region_zoom = region_zoom;
    }

    public boolean isTester() {
        return tester;
    }

    public void setTester(boolean tester) {
        this.tester = tester;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

}
